package com.xbongbong.paas.service.recheck.config;

import com.xbongbong.paas.service.recheck.AbstractRecheckAddEditStrategy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Map;
import java.util.stream.Collectors;

/**
 * 新建页判重策略config
 * @author 杨磊
 *
 */
@Configuration
public class RecheckingAddConfig {

    @Autowired
    private Map<String, AbstractRecheckAddEditStrategy> recheckAddAndEditStrategyMap;

    @Bean("recheckAddAndEditStrategyMap")
    public Map<Integer, AbstractRecheckAddEditStrategy> recheckAddAndEditStrategyMap() {
        return recheckAddAndEditStrategyMap.values().stream().collect(Collectors.toMap(AbstractRecheckAddEditStrategy::businessType, t -> t));
    }
}
